package com.ujiuye.controller;

import com.ujiuye.pojo.CollectionBean;
import com.ujiuye.pojo.Student;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.Arrays;
import java.util.List;
import java.util.Map;

@RequestMapping("/form")
@Controller
public class FormController {

    @RequestMapping("/demo1")
    public String demo1(String username,String password,Integer age){
        System.out.println("username="+username);
        System.out.println("password="+password);
        System.out.println("age="+age);
        return "main";//这里只是随意选一个页面，没有什么特殊含意，只是不让报404
    }

    @RequestMapping("/demo2")
    public String demo2(Student student){//参数中直接使用这个对象
        System.out.println(student);
        return "main";
    }

    @RequestMapping("/demo3")
    public String demo3(CollectionBean collectionBean){
        List mylist = collectionBean.getMylist();
        System.out.println(mylist);

        Map mymap = collectionBean.getMymap();
        System.out.println(mymap);

        Object[] myarr = collectionBean.getMyarr();
        System.out.println(Arrays.toString(myarr));

        List mypet = collectionBean.getMypet();
        System.out.println(mypet);

        return "main";
    }
}
